package es.abredatos.client.view;

import com.google.gwt.maps.client.MapWidget;
import com.google.gwt.maps.client.control.LargeMapControl;
import com.google.gwt.maps.client.geom.LatLng;
import com.google.gwt.maps.client.overlay.Marker;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.Label;
import com.google.gwt.user.client.ui.VerticalPanel;

import es.abredatos.client.presenter.LibrariesPresenter;

public class LibrariesView extends Composite implements LibrariesPresenter.Display {

	private Label viewTitle;
	private MapWidget map;

	public LibrariesView() {

		viewTitle = new Label(getClass().getName());

		map = new MapWidget(LatLng.newInstance(28.059, -15.445), 12);
		map.setSize("400px", "300px");
		map.addControl(new LargeMapControl());

		VerticalPanel vPanel = new VerticalPanel();
		vPanel.add(viewTitle);
		vPanel.add(map);

		initWidget(vPanel);
	}

	public void setCoordinates(double latitude, double longitude) {
		map.addOverlay(new Marker(LatLng.newInstance(latitude, longitude)));
	}

}
